<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>二维码管理</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/select.css" rel="stylesheet" type="text/css" />
<link href="viewer/viewer.min.css" rel="stylesheet" type="text/css" />
<link href="css/font/iconfont.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="layui/jquery.min.js"></script>
<script type="text/javascript" src="viewer/viewer.min.js"></script>
<script type="text/javascript" src="js/select-ui.min.js"></script>

</head>


<body onload="biad()">
	<!-- 隐藏域 -->
	<input type="hidden" id="hid"/>
	
	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="index.html">首页</a></li>
    <li><a href="#">二维码管理</a></li>
    <li><a href="#">图片</a></li>
    </ul>
    </div>
    <!--搜索-->
    <div class="tools">    
       <ul class="forminfo" style="margin-top: 10px">
       	 <li><label>二维码类型</label> 
    		<div class="vocation">
   				<select class="select1" id="sctype">
   					<option value="">-请选择-</option>
    				<option value="1">文本类型</option>
    				<option value="2">坐标类型</option>
    				<option value="3">网址类型</option>
    			</select>
   			</div>  	
   			<input style="margin-left: 10px" type="button" class="scbtn" value="查询"/>		
   		</li>

       </ul>

    </div>
    
    <div class="rightinfo">
    <!--二维码列表 -->       
    <ul class="classlist" id="qrList">
    
    </ul>
    
    <div class="clear"></div>
   
    <div class="pagin">
    	<div class="message">共<i class="blue">1256</i>条记录，当前显示第&nbsp;<i class="blue">2&nbsp;</i>页</div>
        <ul class="paginList">
        <li class="paginItem"><a href="javascript:;"><span class="pagepre"></span></a></li>
        <li class="paginItem"><a href="javascript:;">1</a></li>
        <li class="paginItem current"><a href="javascript:;">2</a></li>
        <li class="paginItem"><a href="javascript:;">3</a></li>
        <li class="paginItem"><a href="javascript:;">4</a></li>
        <li class="paginItem"><a href="javascript:;">5</a></li>
        <li class="paginItem more"><a href="javascript:;">...</a></li>
        <li class="paginItem"><a href="javascript:;">10</a></li>
        <li class="paginItem"><a href="javascript:;"><span class="pagenxt"></span></a></li>
        </ul>
    </div>
        
    <div class="tip">
    	<div class="tiptop"><span>提示信息</span><a></a></div>
        
      <div class="tipinfo">
        <span><img src="images/ticon.png" /></span>
        <div class="tipright">
        <p>是否确认删除此信息 ？</p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite>
        </div>
        </div>
        
        <div class="tipbtn">
        <input name="" type="button"  class="sure" value="确定" />&nbsp;
        <input name="" type="button"  class="cancel" value="取消" />
        </div>
    
    </div>    
         
    </div>
    
<script type="text/javascript">

$(document).ready(function(e) {
    $(".select1").uedSelect({
		width :167		  
	});
});
	function biad(){
		$.ajax({
			url:"/Servicing/qr/getQrInfo",
			dataType:"json",
			type:"POST",
			success:function(result){
				$.each(result,function(key,value){
					var str="";
					var type="";
					switch(value.qrType){
					case 1:
						type="文本类型";
						break;
					case 2:
						type="坐标类型";
						break;
					case 3:
						type="网址类型";
						break;
					}
					str="<li id="+value.id+">"+
					"<span><img style='width: 100px;height: 100px' src='data:image/png;base64,"+value.qrBase+" '/></span>"+
					"<div class='tipright'><a id="+value.id+" onclick='test(this.id)' style='position: relative;right:-80px;top:-20px;'><i style='font-size: 18px;color:red'title='删除' class='iconfont icon-shanchu_'></i></a><h2>编码："+value.qrCode+"</h2><p>类型："+type+"<br/>"+
					"<a id="+value.id+" class='enter' onclick='readQrCode(this.id)'>读取信息</a>"+
					"</div></li>"
					$('.classlist').append(str);
				})			
				$('#qrList').viewer();
			}
		})
	} 
	//搜索
	$('.scbtn').click(function(){
		var type=$('#sctype').val();
		console.log(type);
		var jsonstr={"qrType":type};
		$.ajax({
			url:"/Servicing/qr/getQrInfo",
			data:jsonstr,
			dataType:"json",
			type:"POST",
			success:function(result){
				var str="";
				$.each(result,function(key,value){
					
					var type="";
					switch(value.qrType){
					case 1:
						type="文本类型";
						break;
					case 2:
						type="坐标类型";
						break;
					case 3:
						type="网址类型";
						break;
					}
					str+="<li id="+value.id+">"+
					"<span><img style='width: 100px;height: 100px' src='data:image/png;base64,"+value.qrBase+" '/></span>"+
					"<div class='tipright'><a id="+value.id+" onclick='test(this.id)' style='position: relative;right:-80px;top:-20px;'><i style='font-size: 18px;color:red'title='删除' class='iconfont icon-shanchu_'></i></a><h2>编码："+value.qrCode+"</h2><p>类型："+type+"<br/><a class='enter'>读取信息</a>"+
					"</div></li>"
					
				})	
				$('.classlist').html(str);
			}
		})
	})
function test(id){
	$('#hid').val(id);
	$(".tip").fadeIn(200);
}
$(".sure").click(function(){
	var id=$('#hid').val();
	var jsonstr={"id":id};
	$.ajax({
		url:"/Servicing/qr/deleteQr",
		data:jsonstr,
		dataType:"text",
		type:"POST",
		success:function(result){
			if(result=="success"){
				 $(".tip").fadeOut(100);
				alert("删除成功！");
				location.reload();
			}else{
				 $(".tip").fadeOut(100);
				alert("删除失败！");
			}
		}
	})
})
$(".cancel").click(function(){
	  $(".tip").fadeOut(100);
});
//读取二维码信息
function readQrCode(id){
	if(id!=null&&id!=""){
		window.location.href="qrscan.html?qid="+id;
	}
}
</script>
</body>
</html>
